package demo7;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Demo {
/**spring管理对象是：单例和多例
 * 单例模式 Singleton
 * 单例模式是23种设计模式之一全局只有一个实例*/
public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx =
            new AnnotationConfigApplicationContext("demo7");
    DBConnect dbc = ctx.getBean(DBConnect.class);
    System.out.println(dbc);
    DBConnect dbc2= ctx.getBean(DBConnect.class);
    System.out.println(dbc2);

}







}
